/*
 * @Author       : 邱狮杰
 * @Date         : 2021-09-01 17:58:52
 * @LastEditTime : 2021-09-01 18:11:12
 * @FilePath     : /newhope/src/utils/longMove.ts
 * @Description  :
 */

import { ref } from 'vue'
export function useHoldDown(wait?: number)//鼠标按下时触发
{
	const longClick = ref(0),
		timeOutEvent = ref(0)
	function start(cb?: () => void) {
		longClick.value = 0;
		// @ts-ignore
		timeOutEvent.value = setTimeout(function () {
			longClick.value = 1;
			console.log("这是长按")
		}, wait || 1000);

	}
	function end() {
		clearTimeout(timeOutEvent.value)
	}
	return [start, end]
}